package com.zhoux.collections.genericity;

/**
 * @author taoyi
 * @version 1.0
 * @date 2021/3/18 9:32
 *
 * 本类用于测试泛型的优点2
 */
public class Generic_Test1 {
    public static void main(String[] args) {
        // 需求：打印数组中的所有元素
        Integer[] a = {1,2,3,4,5,6,7,8,9};
        Double[] b = {1.1, 0.2, 0.4, 3.3, 5.0, 4.6, 6.3, 5.6};
        String[] c = {"11","22","33","44","55","66","77","88","99"};
        print(a);
        print(b);
        print(c);

    }

    public static <E> void print(E[] arr){
        for (E i: arr) {
            System.out.print(i+"\t");
        }
        System.out.println();
    }
}
